package com.iworkh.spring.anno;

import com.iworkh.spring.anno.config.AppConfig;
import com.iworkh.spring.anno.controller.StudentController;
import com.iworkh.spring.anno.dao.BaseDao;
import com.iworkh.spring.anno.domain.entity.Student;
import com.iworkh.spring.anno.service.StudentService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 注解方式-入口启动类
 *
 * @author: iworkh-沐雨云楼
 * @date: 2019-12-18
 */

public class AppByAnno {

    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);

        StudentController studentController = (StudentController) context.getBean("studentController");
        System.out.println(studentController);

        StudentService studentService = (StudentService) context.getBean("studentService");
        System.out.println(studentService);

        BaseDao<Student> studentDao = (BaseDao<Student>) context.getBean("studentDao");
        System.out.println(studentDao);

        Student student = (Student) context.getBean("student");
        System.out.println(student);

        studentController.delete("11");
    }
}
